//
//  BEOrderDetailPayFooter.swift
//  BEGlobalOiler
//
//  Created by KKING on 16/9/23.
//  Copyright © 2016年 Bullseye Energy pte ltd. All rights reserved.
//

import UIKit
import DLRadioButton


class BEOrderDetailPayFooter: UIView {
    
    
    var orderId: Int64 = 0
    
    class func footer()->UIView {
        return Bundle.main.loadNibNamed("BEOrderDetailPayFooter", owner: nil, options: nil)!.last as! UIView
    }
    
    @IBAction private func logSelectedButton(radioButton : DLRadioButton) {
        if (radioButton.isMultipleSelectionEnabled) {
            for button in radioButton.selectedButtons() {
                print(String(format: "%@ is selected.\n", button.titleLabel!.text!));
            }
        } else {
            print(String(format: "%@ is selected.\n", radioButton.selected()!.titleLabel!.text!));
        }
    }
    
        
    @IBAction func orderComplete(sender: UIButton) {
        JFProgressHUD.showloading()
        BENetworkTools.shareNetworkTool.orderComplete(orderId: orderId) { (success, result, error) in
            guard let resultjson = result else {
                JFProgressHUD.showWithStatus(status: "Network fault!")
                return
            }
            if resultjson["success"] == true {
                JFProgressHUD.showSuccessWithStatus(status: "")
            } else {
                JFProgressHUD.showInfoWithStatus(status: resultjson["message"].stringValue)
            }
        }
    }
}
